package sk.naive.talker.message;

import java.util.*;

/**
 * Category.
 *
 * @author <a href="mailto:virgo@naive.deepblue.sk">Richard "Virgo" Richter</a>
 * @version $Revision: 1.5 $ $Date: 2004/04/28 21:59:42 $
 */
public class Category {
	private static final Map<String,Category> nameCategory = new LinkedHashMap<String,Category>();

	public static final Category SAY = new Category("say");
	public static final Category TELL = new Category("tell");
	public static final Category SHOUT = new Category("shout");
	public static final Category SYSTEM = new Category("system");
	public static final Category AFK = new Category("afk");
	public static final Category BOARD = new Category("board");
	public static final Category EDITOR = new Category("editor");
	public static final Category INOUT = new Category("inOut");
	public static final Category LOCAL = new Category("local");
	public static final Category MAGIC = new Category("magic");

	private String name;

	private Category(String name) {
		this.name = name;
		nameCategory.put(name, this);
	}

	public Category get(String name) {
		return nameCategory.get(name);
	}

	public String toString() {
		return name;
	}

	public static Set<String> allCategoryNames() {
		return Collections.unmodifiableSet(nameCategory.keySet());
	}

	public static Collection<Category> allCategories() {
		return Collections.unmodifiableCollection(nameCategory.values());
	}

	public static Category forName(String name) {
		return nameCategory.get(name);
	}
}
